package com.edu.service.imlp;

import com.edu.dao.UserDao;
import com.edu.dao.impl.UserDaoImlp;
import com.edu.entity.User;
import com.edu.service.UserService;

public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImlp();

    @Override
    public User queryByIdUser(int id) {
        return userDao.getByID(id);
    }

    @Override
    public boolean updateUser(User user) {
        return userDao.updateUser(user) == 1 ? true : false;
    }

    @Override
    public User queryByusernameUser(String username) {
        return userDao.getByUsername(username);
    }

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public User getByUsernameAndPassword(String username, String password) {
        return userDao.getByUsernameAndPassword(username,password);
    }
}
